package com.tangbao.comment.service;

import com.tangbao.comment.model.Comment;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;

import javax.ws.rs.*;
import javax.ws.rs.core.Response;

/**
 * 功能: 评论服务
 * 创建人:zhouxin
 * 创建时间:2018/9/29
 */
@Component
@Path("/comment")
@Produces({ "application/json" })
public interface CommentService {

    /**
     *
     * @param currentPage 当前页
     * @param pageSize 页大小
     * @return
     */
    @GET
    @Path("/getCommentList")
    Response getCommentByAll(@QueryParam("currentPage") Integer currentPage, @QueryParam("pageSize") Integer pageSize);

    /**
     *获取单一评论详情
     * @param commentId
     * @return
     */
    @GET
    @Path("/getCommentById/{commentType}")
    Response getCommentById(@PathParam(value = "commentType") String commentType,@QueryParam(value = "commentId") String commentId);

    /**
     * 根据资讯id查询相关评论
     * @param artId
     * @param currentPage 当前页
     * @param pageSize 页大小
     * @return
     */
    @GET
    @Path("/getCommentsByArtId/{commentType}/{artId}")
    Response getCommentsByArtId(@PathParam(value = "commentType") String commentType,@PathParam(value = "artId") Integer artId,@QueryParam("currentPage") Integer currentPage, @QueryParam("pageSize") Integer pageSize);

    /**
     * 新增一级评论
     * @param comment
     * @return
     */
    @POST
    @Consumes(MediaType.APPLICATION_JSON_VALUE)
    @Path("/saveComment/{commentType}/{artId}")
    Response saveComment(@PathParam(value = "commentType") String commentType,@PathParam(value = "artId") Integer artId,Comment comment);

    /**
     * 编辑评论
     * @param comment
     * @return
     */
    @POST
    @Consumes(MediaType.APPLICATION_JSON_VALUE)
    @Path("/updateComment/{commentType}/{artId}")
    Response updateComment(@PathParam(value = "commentType") String commentType,@PathParam(value = "artId") Integer artId,Comment comment);


}
